package com.caocaog.market.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.jeecg.common.system.base.entity.groups.InsertGroup;
import org.jeecg.common.system.base.entity.groups.SelectGroup;
import org.jeecg.common.system.base.entity.AllEntity;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 购物车
 *
 * @author chechen
 * @date 2022-04-06
 */
@Data
@TableName("mk_member_cart")
@Accessors(chain = true)
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "mk_member_cart对象", description = "会员购物车")
public class ShopCart extends AllEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty("ID")
    private String id;

    @NotBlank(message = "门店id不能为空", groups = {SelectGroup.class})
    @ApiModelProperty(value = "门店id")
    private String shopId;

    @NotBlank(message = "用户id不能为空", groups = {SelectGroup.class})
    @ApiModelProperty(value = "用户id")
    private String memberId;

    @ApiModelProperty(value = "商品id")
    private String goodsId;

    @ApiModelProperty(value = "商品规格id")
    private String specId;

    @ApiModelProperty(value = "商品属性id")
    private String attributeId;

    @ApiModelProperty(value = "商品名称")
    private String goodsName;

    @ApiModelProperty(value = "规格名称")
    private String specName;

    @ApiModelProperty(value = "属性名称")
    private String attributeStr;

    @ApiModelProperty(value = "加购数量")
    private Integer num;

    @ApiModelProperty(value = "商品图片")
    private String picture;

    @ApiModelProperty(value = "商品现价")
    private String price;

    @ApiModelProperty(value = "销量")
    private Integer saleNum;

    @ApiModelProperty(value = "打包费")
    private String packFee;

    @ApiModelProperty(value = "库存")
    private Integer stock;

    @ApiModelProperty(value = "是否单点不送")
    private Boolean oneNoDelivery;

    @TableField(exist = false)
    @NotNull(message = "添加或删除购物车时，类型不能为空", groups = {InsertGroup.class})
    // @Pattern(regexp ="^-[1][1]＄", message = "购物车商品的操作增减数量只能为 1 或 -1")
    @ApiModelProperty(value = "类型 加(1) 减(-1)")
    private int type;

}
